import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import BusinessList from '../views/BusinessList.vue'
import BusinessInfo from '../views/BusinessInfo.vue'
import Login from "../views/Login";
import Register from "../views/Register";
import Payment from "../views/Payment";
import Order from "../views/Order";
import OrderList from "../views/OrderList";
import Address from "../views/Address";
import NewAddress from "../views/NewAddress";
import UserInfo from "../views/UserInfo";

Vue.use(VueRouter)

const routes = [{
		path: '/',
		name: 'Home',
		component: Index
	}, {
		path: '/index',
		name: 'Index',
		component: Index
	}, {
		path: '/businessList',
		name: 'BusinessList',
		component: BusinessList
	}, {
		path: '/businessInfo',
		name: 'BusinessInfo',
		component: BusinessInfo
	}, {
		path: '/login',
		name: 'Login',
		component: Login
	}, {
		path: '/register',
		name: 'Register',
		component: Register
	},{
		path: '/payment',
		name: 'Payment',
		component: Payment
	},{
		path: '/order',
		name: 'Order',
		component: Order
	},{
		path: '/orderList',
		name: 'OrderList',
		component: OrderList
	},{
		path: '/address',
		name: 'Address',
		component: Address
	},{
		path: '/newAddress',
		name: 'NewAddress',
		component: NewAddress
	},{
		path: '/userInfo',
		name: 'UserInfo',
		component: UserInfo
	}


]

//解决重复路由报异常问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
